﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

using MvcContrib.FluentHtml;

using Revis.VClinicNet.App.Internal.Dto;
using Revis.VClinicNet.Core.Domain.Credentials;
using Revis.VClinicNet.Util.Translation;

namespace Revis.VClinicNet.UI.Internal.Mvc.Models
{
    public class PatientCreateModel : PatientCreateDto
    {
        public IEnumerable<SelectListItem> Doctors { get; protected set; }

        public PatientCreateModel(PatientCreateDto patientCreateDto, IList<DoctorInfoDto> doctors) :
            this(doctors)
        {
            DoctorId = patientCreateDto.DoctorId;
            Personal = patientCreateDto.Personal;
        }

        public PatientCreateModel(IList<DoctorInfoDto> doctors)
        {
            doctors = doctors ?? new List<DoctorInfoDto>();
            Doctors = doctors.Select(d => {
                return new SelectListItem() {
                    Text = d.Name,
                    Value = d.Id.ToString()
                };
            });
        }
    }

    public class PatientEditModel : PatientEditDto
    {
        public IEnumerable<SelectListItem> Doctors { get; protected set; }

        public PatientEditModel(PatientEditDto patientEditDto, IList<DoctorInfoDto> doctors)
        {
            Id = patientEditDto.Id;
            DoctorId = patientEditDto.DoctorId;
            Personal = patientEditDto.Personal;

            doctors = doctors ?? new List<DoctorInfoDto>();
            Doctors = doctors.Select(d => {
                return new SelectListItem() {
                    Text = d.Name,
                    Value = d.Id.ToString()
                };
            });
        }
    }
}